<script lang="ts">
import { defineComponent, reactive, ref, toRefs } from "vue";
interface User {
  name: string;
  setName(userName: string): void;
}
export default defineComponent({
  name: "buttonorigin",
  setup() {
    const user: User = reactive({
      name: "liwang",
      setName(userName) {
        console.log(userName);
        this.name = userName;
      },
    });
    user.setName("liwang1");
    console.log(user);
    const onClick = () => {
      console.log(1);
    };
    return {
      onClick,
      ...toRefs(user),
    };
  },
});
</script>
<template>
  {{ name }}
  <el-button class="" @click="setName('liwang2')">buttonorigin</el-button>
</template>
<style lang="scss" scoped></style>
